<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			
		</style>
		<script src="../js/jquery-1.12.4.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<script type="text/javascript">
			$(function(){
				var reg=/^china$/
				var regs=new RegExp("china","i")
				var str="chIna"
				var result=regs.test(str)
				var reg=/cat/
				var str="cat"
				//查找：返回reg
				var result=str.match(reg)
				//替换：返回dog
				var result=str.replace(reg,"dog")
				//返回this is a dog,cat names is doudou
				var strs="this is a cat,cat names is doudou"
				var result=strs.replace(reg,"dog")
				//全局替换:返回this is a dog,dog names is doudou
				var reg=/cat/g
				var strs="this is a cat,cat names is doudou"
				var result=strs.replace(reg,"dog")
				//分割
				var result=strs.split(" ")
				//alert(result)
			})
		</script>
	</body>
</html>
